#include <iostream>
using namespace std;

class Array
{
    public:
    ////////////构造//////////////
    Array(int count){
        this->count =count;
        Arr = new int[count];
        cout <<"Array()" << endl;
    }
    Array(const Array & arr){
          this->count=arr.count;
          this->Arr =new int[count];
          for(int i=0;i<count;i++){
            this->Arr[i]=arr.Arr[i];
          }
           cout <<"Array(const Array & arr)" << endl;
    }
    ~Array(){
        delete [] Arr;
        Arr =nullptr;
        cout << "~Array():"<<count <<endl ;
    }
    ///////////函数/////////////////
    void printAddress(){
        cout << "address: " <<Arr <<endl;
    }
    void setCount(int count) {this->count=count;}
    int  getVount(){return count;}

    private:
    int count;
    int *Arr;
};
// 栈上实例化
void stackInstatiation()
{
    Array arr1(5);
    //调用拷贝构造
    Array arr2 =arr1;
    arr2.setCount(5);
    arr1.printAddress();
    arr2.printAddress();
}
int main(){
    stackInstatiation();
    return 0;
    
}